
package nc.impl.pu.praybillquery.praybillqueryhvo;

import java.util.List;

import nc.bs.framework.common.NCLocator;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.BeanListProcessor;
import nc.md.model.MetaDataException;
import nc.md.persist.framework.IMDPersistenceQueryService;
import nc.ui.pub.print.IMetaDataDataSource;
import nccloud.framework.core.exception.ExceptionUtils;
import nc.vo.pu.praybillquery.PraybillqueryHVO;

public class PraybillqueryHVOPrintDataSource implements IMetaDataDataSource {

	private static final long serialVersionUID = 1L;

	private String[] oids;

	public PraybillqueryHVOPrintDataSource(String[] oids) {
		this.oids = oids;
	}

	@SuppressWarnings("unchecked")
	@Override
	public Object[] getMDObjects() {
		IUAPQueryBS bs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
		PraybillqueryHVO[] aggvos = new PraybillqueryHVO[] {};
		try { 
			List<PraybillqueryHVO>  list = (List<PraybillqueryHVO> )bs.executeQuery("  select * from po_praybill_b po_praybill_b where pk_praybill_b in('"
					+String.join("','", this.oids)
									+"') ORDER by ( CASE WHEN length ( vbdef20 ) >= 10 then substr ( vbdef20, 0, 10 ) ELSE '' END ) || ( SELECT b.vbillcode FROM po_praybill_b a INNER JOIN po_praybill b ON a.pk_praybill = b.pk_praybill WHERE a.pk_praybill_b = po_praybill_b.pk_praybill_b ) desc ", new BeanListProcessor(PraybillqueryHVO.class));
			aggvos =  list.toArray(new PraybillqueryHVO[0]);
		} catch (Exception e) {
			ExceptionUtils.wrapException(e);
		}
		return aggvos;
	}

	@Override
	public String[] getItemValuesByExpress(String itemExpress) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean isNumber(String itemExpress) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public String[] getDependentItemExpressByExpress(String itemExpress) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String[] getAllDataItemExpress() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String[] getAllDataItemNames() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getModuleName() {
		// TODO Auto-generated method stub
		return null;
	}

}
